Skip to content

ci(dependabot): 入队改用「重试到必需检查通过」,修 #207 的自锁死 - #208

Merged
wangzhizhou merged 1 commit into
mainfrom
ci/dependabot-retry-enqueue
Nov 23, 2026
Merged

wangzhizhou merged 1 commit into
mainfrom
ci/dependabot-retry-enqueue

Conversation

@wangzhizhou

Copy link
Copy Markdown
Contributor

#207 的自锁死

#207 用 mergeStateStatus == CLEAN 判断“必需检查跑完”,但 job 自身也是一个 check(job 名就叫 dependabot):只要它还在轮询,状态就永远到不了 CLEAN。

实测 #205 / #206(run 45106782960 / 45106805540,已手动 cancel):

pr205 mergeStateStatus=UNSTABLE   pending=[dependabot]   total=19 checks
pr206 mergeStateStatus=UNSTABLE   pending=[dependabot]

—— 唯一还没完成的检查就是 workflow 自己。结果是等到 30 分钟超时才告警,PR 依旧不合入。

改动

不再猜 mergeStateStatus 的语义,直接反复调 enqueuePullRequest,让 GitHub 用它自己的必需检查清单裁决(它返回的 required status checks have not succeeded 才是权威答案):

enqueue 返回 处理
成功 打印队列位置,退出 0
required status checks have not succeeded / not mergeable / still in progress 45s 后重试,最多 40 次(30 分钟)
is closed / already in the merge queue 无需处理,退出 0
其它错误 ::warning:: 带上原文退出,不静默

成功入队的 PR 会由 merge queue 自己跑 merge group CI,通过才落库;major 升级依旧不自动入队。

验证计划

合入后对 #205 / #206 再发一次 @dependabot rebase → 新 workflow 应在 CI 跑完后自动入队(日志出现 已加入 merge queue(第 N 次尝试) + state:QUEUED),全程无人工 enqueuePullRequest。

#207 用 `mergeStateStatus == CLEAN` 判断“检查跑完”,但**本 job 自身也是一个 check**
(job 名 `dependabot`):只要它还在轮询,状态就永远不是 CLEAN —— 实测 #205 / #206 的
唯一 pending 检查正是 `dependabot` 自己,等于等到超时才告警,PR 依旧不合入。

改为不猜状态,直接反复调 `enqueuePullRequest`,由 GitHub 用它自己的必需检查清单裁决:

- 成功 → 打印队列位置并退出;
- `required status checks have not succeeded` / `not mergeable` / `still in progress`
  → 45s 后重试,最多 40 次(30 分钟);
- `is closed` / `already in the merge queue` → 无需处理;
- 其它错误 → `::warning::` 带上原文退出,不静默。

这样既避开了自锁死,也不依赖对 mergeStateStatus 语义的猜测。
@github-actions github-actions Bot added the ci label Nov 23, 2026
@wangzhizhou
wangzhizhou added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 4a403bb Nov 23, 2026
19 checks passed
@wangzhizhou
wangzhizhou deleted the ci/dependabot-retry-enqueue branch November 23, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant